<?php $this->load->view('common/head');?>
<form action="<?=printUrl('SingleNet','settleSubmit')?>" name="settleSubmit" id="settleSubmit">
  <table class="table table-bordered">
    <thead>
      <tr>
        <th class="bg-primary text-center">项目主题</th>
        <th class="bg-primary text-center">标准动作</th>
        <th class="bg-primary text-center">媒体名称</th>
        <th class="bg-primary text-center">发布时间段</th>
        <th class="bg-primary text-center">发布频次</th>
        <th class="bg-primary text-center">结算申请费用</th>
        <th class="bg-primary text-center">自证照片</th>
        <th class="bg-primary text-center">审核结果</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="text-center"><?php echo $netData['theme']; ?></td>
        <td class="text-center"><?php echo $netData['actionTypeStr']; ?></td>
        <td class="text-center"><?php echo $netData['mediaName'] ?></td>
        <td class="text-center"><?php echo $netData['startTime'].'至'.$netData['endTime'] ?></td>
        <td class="text-center"><?php echo $netData['frequency'] ?></td>
        <td class="text-center col-sm-2">
          <?php if (in_array($action, array('edit'))) {?>
            <?php if (in_array($netData['settleAuditRs'], array(-1,0,3)) ) {?>
            <input type="number" required min="0" step="0.01" class="form-control" id="net[<?=$netData['id']?>][settleApply]" name="net[<?=$netData['id']?>][settleApply]" readonly value="<?=(float)$netData['settleApply']?$netData['settleApply']:$netData['budgetAudit']?>" placeholder="实际费用">
            <?php }else{echo $netData['settleApply'];} ?>
          <?php } ?>
          <?php
          if (in_array($action, array('audit','check'))) {
            echo $netData['settleApply'];
          }
          ?>
        </td>
        <td class="text-center col-sm-2">
            <div id="netUpload<?=$netData['id']?>ImgBox">
              <?php if ($netData['fileData']) {?>
              <a target="_blank" href="<?=$netData['fileData']['viewPath']?>" class="thumbnail">
                <img class="carousel-inner img-responsive img-rounded" src="<?=$netData['fileData']['viewPath']?>">
              </a>
              <?php } ?>
            </div>
            <?php if (in_array($action, array('edit')) && in_array($netData['settleAuditRs'], array(-1,0,3))) { ?>
            <input type="hidden" id="netUpload<?=$netData['id']?>FileId" name="net[<?=$netData['id']?>][fileId]" value="<?=$netData['fileId']?>" readonly="readonly">
            <input type="button" id="netUpload<?=$netData['id']?>" value="上传" />
            <?php
              $netButtonIds[] = 'netUpload'.$netData['id'];
            }
            ?>
            <input type="hidden" name="net[<?=$netData['id']?>][isSettle]" id="net[<?=$netData['id']?>][isSettle]" value="1">
        </td>
        <td class="text-center"><?php echo $netData['settleAuditStr'] ?></td>
      </tr>
      <tr>
        <td class="text-center" colspan="8">
          <button type="submit" class="btn btn-default btn-primary" role="button">提交</button>
          <button type="button" class="btn btn-default btn-primary" role="button" onclick="closeWindow()">关闭</button>
        </td>
      </tr>
    </tbody>
  </table>
</form>
<?php initUploadButtons($netButtonIds, printUrl('Upload','uploadSave',array('dir'=>'image')), 'imgFile'); ?>
<script type="text/javascript">
$(function(){
  initValidation();
});
  //初始化验证
function initValidation(){
  $('form[name="settleSubmit"]').find("input,select,textarea").jqBootstrapValidation("destroy");
  $('form[name="settleSubmit"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
      preventSubmit:false,
      submitSuccess: function (form, event) {
           event.preventDefault();
           ajaxFormSubmit('settleSubmit');
       },
       submitError: function (form, event, errors) {
         event.preventDefault();
         }
    });
}
</script>
<?php $this->load->view('common/foot');?>